(0) Obligation:
Runtime Complexity TRS:
The TRS R consists of the following rules:
bsort(nil) → nil
bsort(.(x, y)) → last(.(bubble(.(x, y)), bsort(butlast(bubble(.(x, y))))))
bubble(nil) → nil
bubble(.(x, nil)) → .(x, nil)
bubble(.(x, .(y, z))) → if(<=(x, y), .(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
last(nil) → 0
last(.(x, nil)) → x
last(.(x, .(y, z))) → last(.(y, z))
butlast(nil) → nil
butlast(.(x, nil)) → nil
butlast(.(x, .(y, z))) → .(x, butlast(.(y, z)))
Rewrite Strategy: FULL
(1) DecreasingLoopProof (EQUIVALENT transformation)
The following loop(s) give(s) rise to the lower bound Ω(2n):
The rewrite sequence
bubble(.(x, .(y, z))) →+ if(<=(x, y), .(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
gives rise to a decreasing loop by considering the right hand sides subterm at position [1,1].
The pumping substitution is [z / .(y, z)].
The result substitution is [ ].
The rewrite sequence
bubble(.(x, .(y, z))) →+ if(<=(x, y), .(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
gives rise to a decreasing loop by considering the right hand sides subterm at position [2,1].
The pumping substitution is [z / .(y, z)].
The result substitution is [x / y].
(2) BOUNDS(2^n, INF)
(3) RenamingProof (EQUIVALENT transformation)
Renamed function symbols to avoid clashes with predefined symbol.
(4) Obligation:
Runtime Complexity Relative TRS:
The TRS R consists of the following rules:
bsort(nil) → nil
bsort(.(x, y)) → last(.(bubble(.(x, y)), bsort(butlast(bubble(.(x, y))))))
bubble(nil) → nil
bubble(.(x, nil)) → .(x, nil)
bubble(.(x, .(y, z))) → if(<=(x, y), .(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
last(nil) → 0'
last(.(x, nil)) → x
last(.(x, .(y, z))) → last(.(y, z))
butlast(nil) → nil
butlast(.(x, nil)) → nil
butlast(.(x, .(y, z))) → .(x, butlast(.(y, z)))
S is empty.
Rewrite Strategy: FULL
(5) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)
Infered types.
(6) Obligation:
TRS:
Rules:
bsort(nil) → nil
bsort(.(x, y)) → last(.(bubble(.(x, y)), bsort(butlast(bubble(.(x, y))))))
bubble(nil) → nil
bubble(.(x, nil)) → .(x, nil)
bubble(.(x, .(y, z))) → if(<=(x, y), .(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
last(nil) → 0'
last(.(x, nil)) → x
last(.(x, .(y, z))) → last(.(y, z))
butlast(nil) → nil
butlast(.(x, nil)) → nil
butlast(.(x, .(y, z))) → .(x, butlast(.(y, z)))
Types:
bsort :: nil:.:if:0' → nil:.:if:0'
nil :: nil:.:if:0'
. :: nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
last :: nil:.:if:0' → nil:.:if:0'
bubble :: nil:.:if:0' → nil:.:if:0'
butlast :: nil:.:if:0' → nil:.:if:0'
if :: <= → nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
<= :: nil:.:if:0' → nil:.:if:0' → <=
0' :: nil:.:if:0'
hole_nil:.:if:0'1_0 :: nil:.:if:0'
hole_<=2_0 :: <=
gen_nil:.:if:0'3_0 :: Nat → nil:.:if:0'
(7) OrderProof (LOWER BOUND(ID) transformation)
Heuristically decided to analyse the following defined symbols:
bsort,
last,
bubble,
butlastThey will be analysed ascendingly in the following order:
last < bsort
bubble < bsort
butlast < bsort
(8) Obligation:
TRS:
Rules:
bsort(
nil) →
nilbsort(
.(
x,
y)) →
last(
.(
bubble(
.(
x,
y)),
bsort(
butlast(
bubble(
.(
x,
y))))))
bubble(
nil) →
nilbubble(
.(
x,
nil)) →
.(
x,
nil)
bubble(
.(
x,
.(
y,
z))) →
if(
<=(
x,
y),
.(
y,
bubble(
.(
x,
z))),
.(
x,
bubble(
.(
y,
z))))
last(
nil) →
0'last(
.(
x,
nil)) →
xlast(
.(
x,
.(
y,
z))) →
last(
.(
y,
z))
butlast(
nil) →
nilbutlast(
.(
x,
nil)) →
nilbutlast(
.(
x,
.(
y,
z))) →
.(
x,
butlast(
.(
y,
z)))
Types:
bsort :: nil:.:if:0' → nil:.:if:0'
nil :: nil:.:if:0'
. :: nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
last :: nil:.:if:0' → nil:.:if:0'
bubble :: nil:.:if:0' → nil:.:if:0'
butlast :: nil:.:if:0' → nil:.:if:0'
if :: <= → nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
<= :: nil:.:if:0' → nil:.:if:0' → <=
0' :: nil:.:if:0'
hole_nil:.:if:0'1_0 :: nil:.:if:0'
hole_<=2_0 :: <=
gen_nil:.:if:0'3_0 :: Nat → nil:.:if:0'
Generator Equations:
gen_nil:.:if:0'3_0(0) ⇔ nil
gen_nil:.:if:0'3_0(+(x, 1)) ⇔ .(nil, gen_nil:.:if:0'3_0(x))
The following defined symbols remain to be analysed:
last, bsort, bubble, butlast
They will be analysed ascendingly in the following order:
last < bsort
bubble < bsort
butlast < bsort
(9) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
last(
gen_nil:.:if:0'3_0(
+(
1,
n5_0))) →
gen_nil:.:if:0'3_0(
0), rt ∈ Ω(1 + n5
0)
Induction Base:
last(gen_nil:.:if:0'3_0(+(1, 0))) →RΩ(1)
nil
Induction Step:
last(gen_nil:.:if:0'3_0(+(1, +(n5_0, 1)))) →RΩ(1)
last(.(nil, gen_nil:.:if:0'3_0(n5_0))) →IH
gen_nil:.:if:0'3_0(0)
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(10) Complex Obligation (BEST)
(11) Obligation:
TRS:
Rules:
bsort(
nil) →
nilbsort(
.(
x,
y)) →
last(
.(
bubble(
.(
x,
y)),
bsort(
butlast(
bubble(
.(
x,
y))))))
bubble(
nil) →
nilbubble(
.(
x,
nil)) →
.(
x,
nil)
bubble(
.(
x,
.(
y,
z))) →
if(
<=(
x,
y),
.(
y,
bubble(
.(
x,
z))),
.(
x,
bubble(
.(
y,
z))))
last(
nil) →
0'last(
.(
x,
nil)) →
xlast(
.(
x,
.(
y,
z))) →
last(
.(
y,
z))
butlast(
nil) →
nilbutlast(
.(
x,
nil)) →
nilbutlast(
.(
x,
.(
y,
z))) →
.(
x,
butlast(
.(
y,
z)))
Types:
bsort :: nil:.:if:0' → nil:.:if:0'
nil :: nil:.:if:0'
. :: nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
last :: nil:.:if:0' → nil:.:if:0'
bubble :: nil:.:if:0' → nil:.:if:0'
butlast :: nil:.:if:0' → nil:.:if:0'
if :: <= → nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
<= :: nil:.:if:0' → nil:.:if:0' → <=
0' :: nil:.:if:0'
hole_nil:.:if:0'1_0 :: nil:.:if:0'
hole_<=2_0 :: <=
gen_nil:.:if:0'3_0 :: Nat → nil:.:if:0'
Lemmas:
last(gen_nil:.:if:0'3_0(+(1, n5_0))) → gen_nil:.:if:0'3_0(0), rt ∈ Ω(1 + n50)
Generator Equations:
gen_nil:.:if:0'3_0(0) ⇔ nil
gen_nil:.:if:0'3_0(+(x, 1)) ⇔ .(nil, gen_nil:.:if:0'3_0(x))
The following defined symbols remain to be analysed:
bubble, bsort, butlast
They will be analysed ascendingly in the following order:
bubble < bsort
butlast < bsort
(12) NoRewriteLemmaProof (LOWER BOUND(ID) transformation)
Could not prove a rewrite lemma for the defined symbol bubble.
(13) Obligation:
TRS:
Rules:
bsort(
nil) →
nilbsort(
.(
x,
y)) →
last(
.(
bubble(
.(
x,
y)),
bsort(
butlast(
bubble(
.(
x,
y))))))
bubble(
nil) →
nilbubble(
.(
x,
nil)) →
.(
x,
nil)
bubble(
.(
x,
.(
y,
z))) →
if(
<=(
x,
y),
.(
y,
bubble(
.(
x,
z))),
.(
x,
bubble(
.(
y,
z))))
last(
nil) →
0'last(
.(
x,
nil)) →
xlast(
.(
x,
.(
y,
z))) →
last(
.(
y,
z))
butlast(
nil) →
nilbutlast(
.(
x,
nil)) →
nilbutlast(
.(
x,
.(
y,
z))) →
.(
x,
butlast(
.(
y,
z)))
Types:
bsort :: nil:.:if:0' → nil:.:if:0'
nil :: nil:.:if:0'
. :: nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
last :: nil:.:if:0' → nil:.:if:0'
bubble :: nil:.:if:0' → nil:.:if:0'
butlast :: nil:.:if:0' → nil:.:if:0'
if :: <= → nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
<= :: nil:.:if:0' → nil:.:if:0' → <=
0' :: nil:.:if:0'
hole_nil:.:if:0'1_0 :: nil:.:if:0'
hole_<=2_0 :: <=
gen_nil:.:if:0'3_0 :: Nat → nil:.:if:0'
Lemmas:
last(gen_nil:.:if:0'3_0(+(1, n5_0))) → gen_nil:.:if:0'3_0(0), rt ∈ Ω(1 + n50)
Generator Equations:
gen_nil:.:if:0'3_0(0) ⇔ nil
gen_nil:.:if:0'3_0(+(x, 1)) ⇔ .(nil, gen_nil:.:if:0'3_0(x))
The following defined symbols remain to be analysed:
butlast, bsort
They will be analysed ascendingly in the following order:
butlast < bsort
(14) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
butlast(
gen_nil:.:if:0'3_0(
+(
1,
n15880_0))) →
gen_nil:.:if:0'3_0(
n15880_0), rt ∈ Ω(1 + n15880
0)
Induction Base:
butlast(gen_nil:.:if:0'3_0(+(1, 0))) →RΩ(1)
nil
Induction Step:
butlast(gen_nil:.:if:0'3_0(+(1, +(n15880_0, 1)))) →RΩ(1)
.(nil, butlast(.(nil, gen_nil:.:if:0'3_0(n15880_0)))) →IH
.(nil, gen_nil:.:if:0'3_0(c15881_0))
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(15) Complex Obligation (BEST)
(16) Obligation:
TRS:
Rules:
bsort(
nil) →
nilbsort(
.(
x,
y)) →
last(
.(
bubble(
.(
x,
y)),
bsort(
butlast(
bubble(
.(
x,
y))))))
bubble(
nil) →
nilbubble(
.(
x,
nil)) →
.(
x,
nil)
bubble(
.(
x,
.(
y,
z))) →
if(
<=(
x,
y),
.(
y,
bubble(
.(
x,
z))),
.(
x,
bubble(
.(
y,
z))))
last(
nil) →
0'last(
.(
x,
nil)) →
xlast(
.(
x,
.(
y,
z))) →
last(
.(
y,
z))
butlast(
nil) →
nilbutlast(
.(
x,
nil)) →
nilbutlast(
.(
x,
.(
y,
z))) →
.(
x,
butlast(
.(
y,
z)))
Types:
bsort :: nil:.:if:0' → nil:.:if:0'
nil :: nil:.:if:0'
. :: nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
last :: nil:.:if:0' → nil:.:if:0'
bubble :: nil:.:if:0' → nil:.:if:0'
butlast :: nil:.:if:0' → nil:.:if:0'
if :: <= → nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
<= :: nil:.:if:0' → nil:.:if:0' → <=
0' :: nil:.:if:0'
hole_nil:.:if:0'1_0 :: nil:.:if:0'
hole_<=2_0 :: <=
gen_nil:.:if:0'3_0 :: Nat → nil:.:if:0'
Lemmas:
last(gen_nil:.:if:0'3_0(+(1, n5_0))) → gen_nil:.:if:0'3_0(0), rt ∈ Ω(1 + n50)
butlast(gen_nil:.:if:0'3_0(+(1, n15880_0))) → gen_nil:.:if:0'3_0(n15880_0), rt ∈ Ω(1 + n158800)
Generator Equations:
gen_nil:.:if:0'3_0(0) ⇔ nil
gen_nil:.:if:0'3_0(+(x, 1)) ⇔ .(nil, gen_nil:.:if:0'3_0(x))
The following defined symbols remain to be analysed:
bsort
(17) NoRewriteLemmaProof (LOWER BOUND(ID) transformation)
Could not prove a rewrite lemma for the defined symbol bsort.
(18) Obligation:
TRS:
Rules:
bsort(
nil) →
nilbsort(
.(
x,
y)) →
last(
.(
bubble(
.(
x,
y)),
bsort(
butlast(
bubble(
.(
x,
y))))))
bubble(
nil) →
nilbubble(
.(
x,
nil)) →
.(
x,
nil)
bubble(
.(
x,
.(
y,
z))) →
if(
<=(
x,
y),
.(
y,
bubble(
.(
x,
z))),
.(
x,
bubble(
.(
y,
z))))
last(
nil) →
0'last(
.(
x,
nil)) →
xlast(
.(
x,
.(
y,
z))) →
last(
.(
y,
z))
butlast(
nil) →
nilbutlast(
.(
x,
nil)) →
nilbutlast(
.(
x,
.(
y,
z))) →
.(
x,
butlast(
.(
y,
z)))
Types:
bsort :: nil:.:if:0' → nil:.:if:0'
nil :: nil:.:if:0'
. :: nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
last :: nil:.:if:0' → nil:.:if:0'
bubble :: nil:.:if:0' → nil:.:if:0'
butlast :: nil:.:if:0' → nil:.:if:0'
if :: <= → nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
<= :: nil:.:if:0' → nil:.:if:0' → <=
0' :: nil:.:if:0'
hole_nil:.:if:0'1_0 :: nil:.:if:0'
hole_<=2_0 :: <=
gen_nil:.:if:0'3_0 :: Nat → nil:.:if:0'
Lemmas:
last(gen_nil:.:if:0'3_0(+(1, n5_0))) → gen_nil:.:if:0'3_0(0), rt ∈ Ω(1 + n50)
butlast(gen_nil:.:if:0'3_0(+(1, n15880_0))) → gen_nil:.:if:0'3_0(n15880_0), rt ∈ Ω(1 + n158800)
Generator Equations:
gen_nil:.:if:0'3_0(0) ⇔ nil
gen_nil:.:if:0'3_0(+(x, 1)) ⇔ .(nil, gen_nil:.:if:0'3_0(x))
No more defined symbols left to analyse.
(19) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
last(gen_nil:.:if:0'3_0(+(1, n5_0))) → gen_nil:.:if:0'3_0(0), rt ∈ Ω(1 + n50)
(20) BOUNDS(n^1, INF)
(21) Obligation:
TRS:
Rules:
bsort(
nil) →
nilbsort(
.(
x,
y)) →
last(
.(
bubble(
.(
x,
y)),
bsort(
butlast(
bubble(
.(
x,
y))))))
bubble(
nil) →
nilbubble(
.(
x,
nil)) →
.(
x,
nil)
bubble(
.(
x,
.(
y,
z))) →
if(
<=(
x,
y),
.(
y,
bubble(
.(
x,
z))),
.(
x,
bubble(
.(
y,
z))))
last(
nil) →
0'last(
.(
x,
nil)) →
xlast(
.(
x,
.(
y,
z))) →
last(
.(
y,
z))
butlast(
nil) →
nilbutlast(
.(
x,
nil)) →
nilbutlast(
.(
x,
.(
y,
z))) →
.(
x,
butlast(
.(
y,
z)))
Types:
bsort :: nil:.:if:0' → nil:.:if:0'
nil :: nil:.:if:0'
. :: nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
last :: nil:.:if:0' → nil:.:if:0'
bubble :: nil:.:if:0' → nil:.:if:0'
butlast :: nil:.:if:0' → nil:.:if:0'
if :: <= → nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
<= :: nil:.:if:0' → nil:.:if:0' → <=
0' :: nil:.:if:0'
hole_nil:.:if:0'1_0 :: nil:.:if:0'
hole_<=2_0 :: <=
gen_nil:.:if:0'3_0 :: Nat → nil:.:if:0'
Lemmas:
last(gen_nil:.:if:0'3_0(+(1, n5_0))) → gen_nil:.:if:0'3_0(0), rt ∈ Ω(1 + n50)
butlast(gen_nil:.:if:0'3_0(+(1, n15880_0))) → gen_nil:.:if:0'3_0(n15880_0), rt ∈ Ω(1 + n158800)
Generator Equations:
gen_nil:.:if:0'3_0(0) ⇔ nil
gen_nil:.:if:0'3_0(+(x, 1)) ⇔ .(nil, gen_nil:.:if:0'3_0(x))
No more defined symbols left to analyse.
(22) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
last(gen_nil:.:if:0'3_0(+(1, n5_0))) → gen_nil:.:if:0'3_0(0), rt ∈ Ω(1 + n50)
(23) BOUNDS(n^1, INF)
(24) Obligation:
TRS:
Rules:
bsort(
nil) →
nilbsort(
.(
x,
y)) →
last(
.(
bubble(
.(
x,
y)),
bsort(
butlast(
bubble(
.(
x,
y))))))
bubble(
nil) →
nilbubble(
.(
x,
nil)) →
.(
x,
nil)
bubble(
.(
x,
.(
y,
z))) →
if(
<=(
x,
y),
.(
y,
bubble(
.(
x,
z))),
.(
x,
bubble(
.(
y,
z))))
last(
nil) →
0'last(
.(
x,
nil)) →
xlast(
.(
x,
.(
y,
z))) →
last(
.(
y,
z))
butlast(
nil) →
nilbutlast(
.(
x,
nil)) →
nilbutlast(
.(
x,
.(
y,
z))) →
.(
x,
butlast(
.(
y,
z)))
Types:
bsort :: nil:.:if:0' → nil:.:if:0'
nil :: nil:.:if:0'
. :: nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
last :: nil:.:if:0' → nil:.:if:0'
bubble :: nil:.:if:0' → nil:.:if:0'
butlast :: nil:.:if:0' → nil:.:if:0'
if :: <= → nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
<= :: nil:.:if:0' → nil:.:if:0' → <=
0' :: nil:.:if:0'
hole_nil:.:if:0'1_0 :: nil:.:if:0'
hole_<=2_0 :: <=
gen_nil:.:if:0'3_0 :: Nat → nil:.:if:0'
Lemmas:
last(gen_nil:.:if:0'3_0(+(1, n5_0))) → gen_nil:.:if:0'3_0(0), rt ∈ Ω(1 + n50)
Generator Equations:
gen_nil:.:if:0'3_0(0) ⇔ nil
gen_nil:.:if:0'3_0(+(x, 1)) ⇔ .(nil, gen_nil:.:if:0'3_0(x))
No more defined symbols left to analyse.
(25) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
last(gen_nil:.:if:0'3_0(+(1, n5_0))) → gen_nil:.:if:0'3_0(0), rt ∈ Ω(1 + n50)
(26) BOUNDS(n^1, INF)